<template>
 <p>{{message}}</p>
</template>
<script setup>
import { onMounted, onUnmounted,ref } from "vue";
import eventBus from "./eventBus";
const message = ref('');
const handleMessage = (newMessage) => {
  console.log(newMessage);
  message.value = newMessage;
};
onMounted(() => {
  eventBus.on("message", handleMessage);
});
onUnmounted(() => {
  eventBus.off("message", handleMessage);
});
//$on $off $emit
</script>
<style></style>
